﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Heaven.Texturing
{
    /// <summary>
    /// Represents a CubeMap
    /// </summary>
    public class CubicTexture : Texture
    {
        #region Fields

        // Texture cube's sides
        PlanarTexture[] sides = null;

        #endregion

        #region Properties

        /// <summary>
        /// The positive X side of this cube texture
        /// </summary>
        public PlanarTexture PositiveX 
        {
            get { return sides[0]; }
            set
            {
                sides[0] = value;
                RaiseChangedEvent();
            }
        }

        /// <summary>
        /// The positive Y side of this cube texture
        /// </summary>
        public PlanarTexture PositiveY
        {
            get { return sides[1]; }
            set
            {
                sides[1] = value;
                RaiseChangedEvent();
            }
        }

        /// <summary>
        /// The positive Z side of this cube texture
        /// </summary>
        public PlanarTexture PositiveZ 
        {
            get { return sides[2]; }
            set
            {
                sides[2] = value;
                RaiseChangedEvent();
            }
        }

        /// <summary>
        /// The negative X side of this cube texture
        /// </summary>
        public PlanarTexture NegativeX 
        {
            get { return sides[3]; }
            set
            {
                sides[3] = value;
                RaiseChangedEvent();
            }
        }

        /// <summary>
        /// The negative Y side of this cube texture
        /// </summary>
        public PlanarTexture NegativeY 
        {
            get { return sides[4]; }
            set
            {
                sides[4] = value;
                RaiseChangedEvent();
            }
        }

        /// <summary>
        /// The negative Z side of this cube texture
        /// </summary>
        public PlanarTexture NegativeZ 
        {
            get { return sides[5]; }
            set
            {
                sides[5] = value;
                RaiseChangedEvent();
            }
        }

        #endregion

        #region Initialization

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="positiveX">The positive X side of this cube texture</param>
        /// <param name="positiveY">The positive Y side of this cube texture</param>
        /// <param name="positiveZ">The positive Z side of this cube texture</param>
        /// <param name="negativeX">The negative X side of this cube texture</param>
        /// <param name="negativeY">The negative Y side of this cube texture</param>
        /// <param name="negativeZ">The negative Z side of this cube texture</param>
        public CubicTexture(PlanarTexture positiveX, PlanarTexture positiveY, PlanarTexture positiveZ, PlanarTexture negativeX, PlanarTexture negativeY, PlanarTexture negativeZ)
        {
            sides = new PlanarTexture[]
            {
                positiveX,
                positiveY,
                positiveZ,
                negativeX,
                negativeY,
                negativeZ
            };
        }

        #endregion
    }
}
